package com.kexio.enterprise.integration.event.domain;

import com.kexio.enterprise.integration.event.enums.EventPriority;

import java.time.LocalDateTime;
import java.util.Map;

/**
 * 事件基础类
 * 
 * @author Kexio
 * @since 1.0.0
 */
public class Event {
    private String eventId;
    private String eventType;
    private String eventName;
    private EventPriority priority;
    private String source;
    private String topic;
    private Object payload;
    private Map<String, Object> metadata;
    private Map<String, String> headers;
    private LocalDateTime timestamp;
    private LocalDateTime expireTime;
    private String correlationId;
    private String causationId;
    private int version;
    private boolean persistent;
    private String aggregateId;
    private String aggregateType;

    public Event() {
        this.eventId = java.util.UUID.randomUUID().toString();
        this.timestamp = LocalDateTime.now();
        this.priority = EventPriority.NORMAL;
        this.version = 1;
        this.persistent = false;
    }

    // Getters and Setters
    public String getEventId() { return eventId; }
    public void setEventId(String eventId) { this.eventId = eventId; }
    
    public String getEventType() { return eventType; }
    public void setEventType(String eventType) { this.eventType = eventType; }
    
    public String getEventName() { return eventName; }
    public void setEventName(String eventName) { this.eventName = eventName; }
    
    public EventPriority getPriority() { return priority; }
    public void setPriority(EventPriority priority) { this.priority = priority; }
    
    public String getSource() { return source; }
    public void setSource(String source) { this.source = source; }
    
    public String getTopic() { return topic; }
    public void setTopic(String topic) { this.topic = topic; }
    
    public Object getPayload() { return payload; }
    public void setPayload(Object payload) { this.payload = payload; }
    
    public Map<String, Object> getMetadata() { return metadata; }
    public void setMetadata(Map<String, Object> metadata) { this.metadata = metadata; }
    
    public Map<String, String> getHeaders() { return headers; }
    public void setHeaders(Map<String, String> headers) { this.headers = headers; }
    
    public LocalDateTime getTimestamp() { return timestamp; }
    public void setTimestamp(LocalDateTime timestamp) { this.timestamp = timestamp; }
    
    public LocalDateTime getExpireTime() { return expireTime; }
    public void setExpireTime(LocalDateTime expireTime) { this.expireTime = expireTime; }
    
    public String getCorrelationId() { return correlationId; }
    public void setCorrelationId(String correlationId) { this.correlationId = correlationId; }
    
    public String getCausationId() { return causationId; }
    public void setCausationId(String causationId) { this.causationId = causationId; }
    
    public int getVersion() { return version; }
    public void setVersion(int version) { this.version = version; }
    
    public boolean isPersistent() { return persistent; }
    public void setPersistent(boolean persistent) { this.persistent = persistent; }
    
    public String getAggregateId() { return aggregateId; }
    public void setAggregateId(String aggregateId) { this.aggregateId = aggregateId; }
    
    public String getAggregateType() { return aggregateType; }
    public void setAggregateType(String aggregateType) { this.aggregateType = aggregateType; }
}